/**
 * @File   : layout.tsx
 * @Author : xue.xiaoBing
 * @Date   : 2024/3/22 16:04
 * @Desc   : 布局组件
 * */

import Taro from "@tarojs/taro";
import {Tabbar} from "@nutui/nutui-react-taro";
import {Category, Home, User} from "@nutui/icons-react-taro";

const Layout = (props) => {
  const {children, defIndex} = props;
  const handleJumpEvent = (index) => {
    let path = '';
    if (index === 0) {
      path =  '/pages/index/index';
    } else if (index === 1 ) {
      path = '/pages/func/index'
    }
    // @ts-ignore
    Taro.redirectTo({url: path})
  }

  return (
    <div className='layout-page'>
      { /** 顶部导航 */ }
      { /** 内容展示*/  }
      {children}
      { /** 底部导航栏 */}
      {/*<div className='bottom-bar'>*/}
      {/*  <Tabbar fixed onSwitch={handleJumpEvent} defaultValue={defIndex} >*/}
      {/*    <Tabbar.Item title='首页' icon={<Home size={18} />} />*/}
      {/*    <Tabbar.Item title='功能' icon={<Category size={18} />} />*/}
      {/*    <Tabbar.Item title='我的' icon={<User size={18} />} />*/}
      {/*  </Tabbar>*/}
      {/*</div>*/}
    </div>
  )
}
export default Layout
